I wanted to write a general function to return a string value of an attribute, but rtf markup for Text and yyyy-MM-dd for dates.
string AttributeValue(Attr__ oAttr)
{
// string sTypeBefore = type(oAttr) // Uncomment to Cause Crash
string sValue = oAttr ""
string sTypeAfter = type(oAttr)
// string sValueAgain = oAttr "" // Uncomment to Cause Crash
return(sValue)
}
Module m = current()
print(AttributeValue(m."Prefix"))
SystemAdmin - Tue Jan 08 10:42:13 EST 2013 |
Re: Attr__ Crash
string AttributeValue(Attr__ oAttr)
{
string sValue = ""
string sType = type(oAttr)
if(sType == "Date") {
Date oDate = oAttr
if(!null(oDate)) {
sValue = stringOf(dateAndTime(oDate), userLocale(), "yyyy-MM-dd")
}
} else if(sType == "Text") {
sValue = richTextWithOle(oAttr)
} else {
sValue = oAttr ""
}
return(sValue)
}
|
Re: Attr__ Crash SystemAdmin - Tue Jan 08 10:47:03 EST 2013
string AttributeValue(Attr__ oAttr)
{
string sValue = ""
string sType = type(oAttr)
if(sType == "Date") {
Date oDate = oAttr
if(!null(oDate)) {
sValue = stringOf(dateAndTime(oDate), userLocale(), "yyyy-MM-dd")
}
} else if(sType == "Text") {
sValue = richTextWithOle(oAttr)
} else {
sValue = oAttr ""
}
return(sValue)
}
Guess it is also freed by the type(Attr__) function too. |